home *** CD-ROM | disk | FTP | other *** search
/ Skunkware 5 / Skunkware 5.iso / man / cat.1 / gdb.1 < prev    next >
Text File  |  1995-07-25  |  13KB  |  331 lines

  1.  
  2.  
  3.  
  4.      ggggddddbbbb((((1111))))                GGGGNNNNUUUU TTTToooooooollllssss ((((4444nnnnoooovvvv1111999999991111))))                 ggggddddbbbb((((1111))))
  5.  
  6.  
  7.  
  8.      NNNNAAAAMMMMEEEE
  9.           gdb - The GNU Debugger
  10.  
  11.      SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
  12.           ggggddddbbbb  [----hhhheeeellllpppp] [----nnnnxxxx] [----qqqq] [----bbbbaaaattttcccchhhh] [----ccccdddd====_d_i_r] [----ffff] [----bbbb _b_p_s]
  13.                [----ttttttttyyyy====_d_e_v] [----ssss _s_y_m_f_i_l_e] [----eeee _p_r_o_g] [----sssseeee _p_r_o_g] [----cccc _c_o_r_e]
  14.                [----xxxx _c_m_d_s] [----dddd _d_i_r] [_p_r_o_g[_c_o_r_e|_p_r_o_c_I_D]]
  15.  
  16.      DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  17.           The purpose of a debugger such as GDB is to allow you to see
  18.           what  is  going  on  ``inside''  another  program  while  it
  19.           executes-or what another program was doing at the moment  it
  20.           crashed.
  21.  
  22.           GDB can do four main kinds of things (plus other  things  in
  23.           support of these) to help you catch bugs in the act:
  24.  
  25.  
  26.              o+ Start your  program,  specifying  anything  that  might
  27.                affect its behavior.
  28.  
  29.  
  30.              o+ Make your program stop on specified conditions.
  31.  
  32.  
  33.              o+ Examine  what  has  happened,  when  your  program  has
  34.                stopped.
  35.  
  36.  
  37.              o+ Change things in your program, so  you  can  experiment
  38.                with  correcting  the  effects  of one bug and go on to
  39.                learn about another.
  40.  
  41.           You can use GDB to debug programs written  in  C,  C++,  and
  42.           Modula-2.   Fortran support will be added when a GNU Fortran
  43.           compiler is ready.
  44.  
  45.           GDB is invoked with the shell command ggggddddbbbb.  Once started, it
  46.           reads  commands  from the terminal until you tell it to exit
  47.           with the GDB command qqqquuuuiiiitttt.  You can get online help from ggggddddbbbb
  48.           itself by using the command hhhheeeellllpppp.
  49.  
  50.           You can run ggggddddbbbb with no arguments or options; but  the  most
  51.           usual  way  to  start  GDB  is  with  one  argument  or two,
  52.           specifying an executable program as the argument:
  53.  
  54.           gdb program
  55.  
  56.  
  57.           You can also start with both an  executable  program  and  a
  58.           core file specified:
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                          (printed 3/28/94)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      ggggddddbbbb((((1111))))                GGGGNNNNUUUU TTTToooooooollllssss ((((4444nnnnoooovvvv1111999999991111))))                 ggggddddbbbb((((1111))))
  71.  
  72.  
  73.  
  74.           gdb program core
  75.  
  76.  
  77.           You can, instead, specify a process ID as a second argument,
  78.           if you want to debug a running process:
  79.  
  80.           gdb program 1234
  81.  
  82.  
  83.           would attach GDB to process 1111222233334444 (unless  you  also  have  a
  84.           file named `1111222233334444'; GDB does check for a core file first).
  85.  
  86.           Here are some of the most frequently needed GDB commands:
  87.  
  88.           bbbbrrrreeeeaaaakkkk [_f_i_l_e::::]_f_u_n_c_t_i_o_n
  89.                 Set a breakpoint at _f_u_n_c_t_i_o_n (in _f_i_l_e).
  90.  
  91.           rrrruuuunnnn [_a_r_g_l_i_s_t]
  92.                Start your program (with _a_r_g_l_i_s_t, if specified).
  93.  
  94.           bbbbtttt   Backtrace: display the program stack.
  95.  
  96.           pppprrrriiiinnnntttt _e_x_p_r
  97.                 Display the value of an expression.
  98.  
  99.           cccc    Continue running your program (after stopping, e.g.  at
  100.                a breakpoint).
  101.  
  102.           nnnneeeexxxxtttt Execute next program line (after stopping);  step  _o_v_e_r
  103.                any function calls in the line.
  104.  
  105.           sssstttteeeepppp Execute next program line (after stopping);  step  _i_n_t_o
  106.                any function calls in the line.
  107.  
  108.           hhhheeeellllpppp [_n_a_m_e]
  109.                Show information about GDB  command  _n_a_m_e,  or  general
  110.                information about using GDB.
  111.  
  112.           qqqquuuuiiiitttt Exit from GDB.
  113.  
  114.           For full details on GDB, see _U_s_i_n_g _G_D_B: _A _G_u_i_d_e _t_o  _t_h_e  _G_N_U
  115.           _S_o_u_r_c_e-_L_e_v_e_l  _D_e_b_u_g_g_e_r, by Richard M. Stallman and Roland H.
  116.           Pesch.  The same text is available online as the  ggggddddbbbb  entry
  117.           in the iiiinnnnffffoooo program.
  118.  
  119.      OOOOPPPPTTTTIIIIOOOONNNNSSSS
  120.           Any arguments other than options specify an executable  file
  121.           and  core  file (or process ID); that is, the first argument
  122.           encountered with no associated option flag is equivalent  to
  123.           a  `----sssseeee'  option, and the second, if any, is equivalent to a
  124.           `----cccc' option if it's the name of a file.  Many  options  have
  125.           both  long  and  short forms; both are shown here.  The long
  126.  
  127.  
  128.  
  129.      Page 2                                          (printed 3/28/94)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      ggggddddbbbb((((1111))))                GGGGNNNNUUUU TTTToooooooollllssss ((((4444nnnnoooovvvv1111999999991111))))                 ggggddddbbbb((((1111))))
  137.  
  138.  
  139.  
  140.           forms are also recognized if you truncate them, so  long  as
  141.           enough  of the option is present to be unambiguous.  (If you
  142.           prefer, you can flag option arguments with `++++'  rather  than
  143.           `----', though we illustrate the more usual convention.)
  144.  
  145.           All the options and command  line  arguments  you  give  are
  146.           processed in sequential order.  The order makes a difference
  147.           when the `----xxxx' option is used.
  148.  
  149.  
  150.           ----hhhheeeellllpppp
  151.  
  152.           ----hhhh   List all options, with brief explanations.
  153.  
  154.  
  155.           ----ssssyyyymmmmbbbboooollllssss====_f_i_l_e
  156.  
  157.           ----ssss _f_i_l_e
  158.                 Read symbol table from file _f_i_l_e.
  159.  
  160.  
  161.           ----eeeexxxxeeeecccc====_f_i_l_e
  162.  
  163.           ----eeee _f_i_l_e
  164.                 Use file _f_i_l_e as the executable file to  execute  when
  165.                appropriate, and for examining pure data in conjunction
  166.                with a core dump.
  167.  
  168.  
  169.           ----sssseeee====_f_i_l_e
  170.                 Read symbol table from file _f_i_l_e and  use  it  as  the
  171.                executable file.
  172.  
  173.  
  174.           ----ccccoooorrrreeee====_f_i_l_e
  175.  
  176.           ----cccc _f_i_l_e
  177.                 Use file _f_i_l_e as a core dump to examine.
  178.  
  179.  
  180.           ----ccccoooommmmmmmmaaaannnndddd====_f_i_l_e
  181.  
  182.           ----xxxx _f_i_l_e
  183.                 Execute GDB commands from file _f_i_l_e.
  184.  
  185.  
  186.           ----ddddiiiirrrreeeeccccttttoooorrrryyyy====_d_i_r_e_c_t_o_r_y
  187.  
  188.           ----dddd _d_i_r_e_c_t_o_r_y
  189.                 Add _d_i_r_e_c_t_o_r_y to the path to search for source files.
  190.  
  191.           ----nnnnxxxx
  192.  
  193.  
  194.  
  195.      Page 3                                          (printed 3/28/94)
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.      ggggddddbbbb((((1111))))                GGGGNNNNUUUU TTTToooooooollllssss ((((4444nnnnoooovvvv1111999999991111))))                 ggggddddbbbb((((1111))))
  203.  
  204.  
  205.  
  206.           ----nnnn   Do   not   execute   commands   from   any   `....ggggddddbbbbiiiinnnniiiitttt'
  207.                initialization  files.  Normally, the commands in these
  208.                files are executed after all the  command  options  and
  209.                arguments have been processed.
  210.  
  211.  
  212.  
  213.           ----qqqquuuuiiiieeeetttt
  214.  
  215.           ----qqqq   ``Quiet''.  Do not print the introductory and copyright
  216.                messages.   These messages are also suppressed in batch
  217.                mode.
  218.  
  219.  
  220.           ----bbbbaaaattttcccchhhh
  221.                Run in batch mode.  Exit with status 0000 after processing
  222.                all   the   command  files  specified  with  `----xxxx'  (and
  223.                `....ggggddddbbbbiiiinnnniiiitttt',  if  not  inhibited).   Exit  with  nonzero
  224.                status if an error occurs in executing the GDB commands
  225.                in the command files.
  226.  
  227.                Batch mode may be useful for running GDB as  a  filter,
  228.                for  example  to  download and run a program on another
  229.                computer; in  order  to  make  this  more  useful,  the
  230.                message
  231.  
  232.                Program exited normally.
  233.  
  234.  
  235.                (which is ordinarily issued whenever a program  running
  236.                under  GDB  control  terminates)  is  not  issued  when
  237.                running in batch mode.
  238.  
  239.  
  240.           ----ccccdddd====_d_i_r_e_c_t_o_r_y
  241.                 Run GDB using  _d_i_r_e_c_t_o_r_y  as  its  working  directory,
  242.                instead of the current directory.
  243.  
  244.  
  245.           ----ffffuuuullllllllnnnnaaaammmmeeee
  246.  
  247.           ----ffff   Emacs  sets  this  option  when  it  runs  GDB   as   a
  248.                subprocess.   It tells GDB to output the full file name
  249.                and line number in  a  standard,  recognizable  fashion
  250.                each  time  a  stack frame is displayed (which includes
  251.                each time the program stops).  This recognizable format
  252.                looks  like  two ` 33332222' characters, followed by the file
  253.                name, line number and character position  separated  by
  254.                colons,  and  a  newline.   The  Emacs-to-GDB interface
  255.                program uses the two ` 33332222' characters as  a  signal  to
  256.                display the source code for the frame.
  257.  
  258.  
  259.  
  260.  
  261.      Page 4                                          (printed 3/28/94)
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.      ggggddddbbbb((((1111))))                GGGGNNNNUUUU TTTToooooooollllssss ((((4444nnnnoooovvvv1111999999991111))))                 ggggddddbbbb((((1111))))
  269.  
  270.  
  271.  
  272.           ----bbbb _b_p_s
  273.                 Set the line speed (baud rate or bits per  second)  of
  274.                any serial interface used by GDB for remote debugging.
  275.  
  276.  
  277.           ----ttttttttyyyy====_d_e_v_i_c_e
  278.                 Run using _d_e_v_i_c_e for your program's standard input and
  279.                output.
  280.  
  281.      SSSSEEEEEEEE AAAALLLLSSSSOOOO
  282.           `ggggddddbbbb' entry in iiiinnnnffffoooo; _U_s_i_n_g _G_D_B: _A _G_u_i_d_e _t_o _t_h_e  _G_N_U  _S_o_u_r_c_e-
  283.           _L_e_v_e_l  _D_e_b_u_g_g_e_r,  Richard  M.  Stallman and Roland H. Pesch,
  284.           July 1991.
  285.  
  286.      CCCCOOOOPPPPYYYYIIIINNNNGGGG
  287.           Copyright (c) 1991 Free Software Foundation, Inc.
  288.  
  289.           Permission is granted to make and distribute verbatim copies
  290.           of  this  manual  provided  the  copyright  notice  and this
  291.           permission notice are preserved on all copies.
  292.  
  293.           Permission  is  granted  to  copy  and  distribute  modified
  294.           versions  of  this  manual under the conditions for verbatim
  295.           copying, provided that the entire resulting derived work  is
  296.           distributed under the terms of a permission notice identical
  297.           to this one.
  298.  
  299.           Permission is granted to copy and distribute translations of
  300.           this   manual   into   another  language,  under  the  above
  301.           conditions  for  modified   versions,   except   that   this
  302.           permission  notice  may be included in translations approved
  303.           by the Free Software Foundation instead of in  the  original
  304.           English.
  305.  
  306.  
  307.  
  308.  
  309.  
  310.  
  311.  
  312.  
  313.  
  314.  
  315.  
  316.  
  317.  
  318.  
  319.  
  320.  
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.      Page 5                                          (printed 3/28/94)
  328.  
  329.  
  330.  
  331.